﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="BranchData.aspx.cs" Inherits="WebForm_BranchData" %>
<script runat="server">
    /* list */
    protected void gv_DataBinding(object sender, EventArgs e)
    {
        var db = new DB();
        var dt = db.Execute(string.Format("SELECT b.* FROM BranchData b WHERE b.CompID = @CompID ORDER BY seq ")
            , new DBParameter("CompID", OrgManager.Current.CurrentComp));

        LocManager.Current.Translate(dt, "BranchData", "BranchName");

        (sender as DataBoundControl).DataSource = dt;

        mv.SetActiveView(mvList);
    }
    /* end of list */
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:MultiView ID="mv" runat="server" ActiveViewIndex="0">
        <asp:View ID="mvList" runat="server">
            <asp:LinkButton ID="btnAdd" runat="server" Text="<%$Resources: Form, btnAdd   %>"
                CommandName="MyInsert" OnClick="btnAdd_Click"></asp:LinkButton>
            <p />
            <My:MyGridView ID="gv" runat="server" OnDataBinding="gv_DataBinding" OnRowCommand="gv_ItemCommand"
                DataKeyNames="BranchID">
                <Columns>
                    <asp:TemplateField HeaderText="<%$Resources: BranchData, BranchID   %>">
                        <ItemTemplate>
                            <%# Eval("BranchID")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources: BranchData, BranchName   %>">
                        <ItemTemplate>
                            <%# Eval("BranchName")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources: BranchData, TaxID   %>">
                        <ItemTemplate>
                            <%# Eval("TaxID")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources: BranchData, Address   %>">
                        <ItemTemplate>
                            <%# Eval("Address")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandName="MyEdit" Text="<%$Resources: Form, btnEdit %>"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="btnDelete" runat="server" CommandName="MyDelete" Text="<%$Resources: Form, btnDelete %>"></asp:LinkButton>
                            <ajax:ConfirmButtonExtender ID="cbDelete" runat="server" TargetControlID="btnDelete"
                                ConfirmText="<%$Resources: Form, cbDelete %>">
                            </ajax:ConfirmButtonExtender>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </My:MyGridView>
        </asp:View>
    </asp:MultiView>
</asp:Content>

